﻿@{
    ViewBag.Title = "子页边距";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@model UcAsp.Net.Model.ArticlesPage
<script type="text/javascript">
    tinymce.init({
        selector: "textarea",
        plugins: [
                "advlist autolink lists link image charmap print preview anchor",
                "searchreplace visualblocks code fullscreen",
                "insertdatetime media table contextmenu paste hr upfile"
            ],
        toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent |link image upfile"

    });
</script>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon"><i class="icon-th"></i></span>
                <h5>
                    类目管理</h5>
            </div>
            <div class="widget-content nopadding">
            <form action="#" method="post" class="form-horizontal">
                <input name="ID" type="hidden" value="@Model.ID" />                
                 <input name="CategoriesID" type="hidden" value="@Model.CategoriesID" />
                  <input name="ArticlesID" type="hidden" value="@Model.ArticlesID" />
                <div class="control-group">
                    <label  class="control-label">
                        标题</label>
                   <div class="controls">
                    <input class="text-input large-input" type="text" name="Title" value="@Model.Title"  />
                </div>
                </div>
                <div class="control-group">
                    <label  class="control-label">
                        图片</label>
                        <div class="controls">
                        <input class="input-small" type="text" name="IconUrl" value="@Model.IconUrl" />
                        <input class="input-small" id="IconUrl" name="IconUrl" type="file" />
                    </div>
                </div>
                <div class="control-group">
                    <label  class="control-label">
                        内容</label>
                       <div class="controls">
                    <textarea id="Remark" name="Remark" cols="20" rows="2">@Model.ArticlesContent</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label  class="control-label">
                        页码</label>
                   <div class="controls">
                    <input class="text-input large-input" type="text" name="PageID" value="@Model.PageID"  />
                </div>
                </div>
                <div class="control-group">
                <div class="controls">
                    <span class="btn save">保存</span>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    var name = [];
    var i = 0;
    $(document).ready(function () {
        $(".save").click(function () {
            UploadFile();
        })
    })
    function UploadFile() {
        $.upload({
            url: '/UploadFile.ashx',
            fileName: name,
            dataType: 'xml',
            onSend: function () {
                return true;
            },
            //上传之后回调
            onComplate: function (data) {
                var imagefile = $("input[name='IconUrl']").val();
                if (data.status == "true") {
                    imagefile = data.filepath;
                }
                $.post("/Admin/SaveArticlesPage", { ID: $("input[name='ID']").val(), CategoriesID: $("input[name='CategoriesID']").val(), PageID: $("input[name='PageID']").val(), IconUrl: imagefile, ArticlesID: $("input[name='ArticlesID']").val(), ArticlesContent: tinyMCE.get("Remark").getContent(), Title: $("input[name='Title']").val() }, function (dataResult) {
                    location.reload();
                });

            }
        });
    }

</script>
